home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 076-100 / disk_091 / samples / demos / baby.adl < prev    next >
Text File  |  1992-05-06  |  7KB  |  262 lines

  1. INCLUDE "standard.adl";
  2.  
  3. { Object properties specific to this scenario }
  4.  
  5. BROKEN = 1;        { The window can be broken }
  6.  
  7.  
  8.  
  9. { Locations in this scenario }
  10.  
  11. NOUN
  12.     room1,
  13.     room2;
  14.  
  15. room1(LIGHT) = TRUE;
  16. room2(LIGHT) = TRUE;
  17.  
  18.  
  19.  
  20. { The vocabulary for this scenario }
  21.  
  22. ADJEC
  23.     sun,
  24.     red,
  25.     blue;
  26.  
  27. NOUN
  28.     wall,
  29.     floor,
  30.     sun window(room2),
  31.     door(room1),
  32.     red ball(room1),
  33.     blue ball(room1);
  34.  
  35. PREP
  36.     against;
  37.  
  38. hard = red;    wooden = red;
  39. soft = blue;    foamy = blue;
  40. sunwindow = sun window;
  41. bounce = throw;
  42.  
  43.  
  44.  
  45.  
  46. { Location descriptions }
  47.  
  48. room1(LDESC) =
  49.     ($say "You are in your bedroom.  All of your really FUN toys have been ")
  50.     ($say "put away, out of your reach.  There is another room to the east.\n")
  51. ;
  52. room1(SDESC) = ($say "Bedroom\n");
  53.  
  54. room2(LDESC) =
  55.     ($say "You are in the nursery.  A pretty yellow sunbeam is shining on the ")
  56.     ($say "floor.  There is another room to the west.\n")
  57. ;
  58. room2(SDESC) = ($say "Nursery\n");
  59.  
  60.  
  61.  
  62.  
  63. { Transition routines }
  64. cg = ($say "You can't go that way.\n");
  65.  
  66. room1(ACTION) =
  67.     ($miss cg cg 0 cg cg cg cg cg cg cg)
  68.     ($hit .ME 0 0 room2 0 0 0 0 0 0 0)
  69. ;
  70.  
  71. room2(ACTION) =
  72.     ($miss cg cg cg 0 cg cg cg cg cg cg)
  73.     ($hit .ME 0 0 0 room1 0 0 0 0 0 0)
  74. ;
  75.  
  76.  
  77.  
  78. { Object specific routines }
  79.  
  80. BallAct =                { ACTION rout for balls }
  81.     (IF ($eq @Verb throw) THEN
  82.     (IF ($ne @Dobj %1) THEN
  83.         { We're the iobj; don't perform an action }
  84.         ($exit 0)
  85.     )
  86.     (IF ($ne @Iobj wall) THEN
  87.         ($say "You throw the ball at the floor, where it bounces a few ")
  88.         ($say "times, then is still.\n")
  89.      ELSE
  90.         ($say "The ball sails through the air, then bounces off the wall ")
  91.         ($say "onto the floor.\n")
  92.     )
  93.     ($move @Dobj ($loc .ME))
  94.     ($exit 1)
  95.     )
  96. ;
  97.  
  98. red ball(LDESC) = ($say "There is a hard, wooden red ball here.\n");
  99. red ball(SDESC) = ($say "a red ball");
  100. red ball(ACTION) = (BallAct [red ball]);
  101.  
  102. blue ball(LDESC) = ($say "There is a soft, foamy blue ball here.\n");
  103. blue ball(SDESC) = ($say "a blue ball");
  104. blue ball(ACTION) = (BallAct [blue ball]);
  105.  
  106.  
  107. NoAct =                    { ACTION rout for wall and floor }
  108.     (IF ($or ($ne @Verb throw) ($ne @Iobj %1)) THEN
  109.     (Silly)
  110.     )
  111. ;
  112.  
  113. wall(NOTAKE) = TRUE;
  114. wall(ACTION) = (NoAct wall);
  115.  
  116. floor(NOTAKE) = TRUE;
  117. floor(ACTION) = (NoAct floor);
  118.  
  119.  
  120. sun window(NOTAKE) = TRUE;
  121. sun window(LDESC) =
  122.     ($say "There is a large sun window here")
  123.     (IF ($prop [sun window] BROKEN) THEN
  124.     ($say ", shattered into a thousand pieces!\n")
  125.      ELSE
  126.     ($say ".\n")
  127.     )
  128. ;
  129. sun window(SDESC) =
  130.     (IF ($prop [sun window] BROKEN) THEN
  131.     ($say "a broken window")
  132.      ELSE
  133.     ($say "a sun window")
  134.     )
  135. ;
  136. sun window(ACTION) =
  137.     (IF ($and ($eq @Verb throw) ($eq @Iobj [sun window])) THEN
  138.     (IF ($eq @Dobj [red ball]) THEN
  139.         ($say "The red ball sails through the window, shattering it!\n")
  140.         ($move [red ball] .ALL)
  141.         ($setp [sun window] BROKEN TRUE)
  142.         ($exit 1)
  143.      ELSEIF ($eq @Dobj [blue ball]) THEN
  144.         (IF ($prop [sun window] BROKEN) THEN
  145.         ($say "The blue ball sails through the broken window!\n")
  146.         ($move [blue ball] .ALL)
  147.          ELSE
  148.         ($say "The blue ball bounces harmlessly off the window.\n")
  149.         ($move [blue ball] room2)
  150.         )
  151.         ($exit 1)
  152.      ELSE
  153.          (Silly)
  154.     )
  155.      ELSEIF ($eq @Verb open) THEN
  156.     ($say "You can't open a sun window!\n")
  157.     ($exit 1)
  158.      ELSEIF ($eq @Verb take) THEN
  159.     (Silly)
  160.     )
  161. ;
  162.  
  163.  
  164. door(NOTAKE) = TRUE;
  165. door(LDESC) = ($say "There is a closed door here.\n");
  166. door(SDESC) = ($say "a door");
  167. door(ACTION) =
  168.     (IF ($and ($eq @Verb throw) ($eq @Iobj door)) THEN
  169.     ($say "The " ($name @Dobj) " bounces harmlessly off of the door.\n")
  170.     ($exit 1)
  171.      ELSEIF ($eq @Verb open) THEN
  172.     ($say "The doorknob is too high for you to reach.\n")
  173.     ($exit 1)
  174.      ELSEIF ($eq @Verb take) THEN
  175.     (Silly)
  176.     )
  177. ;
  178.  
  179.  
  180.  
  181.  
  182. { Scenario dependant routines }
  183.  
  184. Parent =                { The parent fuse }
  185.     (IF ($eq ($loc .ME) room1) THEN
  186.     ($say "Suddenly, the door to your bedroom opens! ")
  187.      ELSE
  188.     ($say "You hear the door in your bedroom opening! ")
  189.     )
  190.     ($say "Your parents enter the room. ")
  191.     (IF ($prop [sun window] BROKEN) THEN
  192.     ($say "Daddy notices the broken window, and turns a funny red color. ")
  193.     ($say "\"I see that you haven't learned your lesson, dear,\" says ")
  194.     ($say "Mommy.  \"I'm afraid that you will have to stay in here for ")
  195.     ($say "at least another hour! ")
  196.     ($say "Mommy and Daddy leave you alone again.  Let's see what other ")
  197.     ($say "fun things there are to do around here...\n")
  198.      ELSE
  199.     ($say "\"Have you learned your lesson, kiddo?\" asks Daddy.  Seeing ")
  200.     ($say "your cute little face seems to have charmed them!  You're off ")
  201.     ($say "the hook!  Mommy and Daddy take you out to see \"The Care ")
  202.     ($say "Bears Eat New York\", and you live happily ever after.\n")
  203.     )
  204.     ($spec QUIT)
  205. ;
  206.  
  207.  
  208. VAR
  209.     Rand[ 10 ];
  210.  
  211. (Rand + 0) = "You wonder if the blue ball will bounce off of the window.\n";
  212. (Rand + 1) = "You wonder if the red ball will bounce off of the window.\n" ;
  213. (Rand + 2) = "You find a piece of lint on the floor, and eat it.  Yum!\n" ;
  214. (Rand + 3) = "You can hear Kitty meowing outside.\n" ;
  215. (Rand + 4) = "You hear Mommy singing in the kitchen.\n" ;
  216. (Rand + 5) = "You practice making disgusting noises.  THPPP!  ZZZKKK!\n" ;
  217. (Rand + 6) = "You hear Daddy hit his head on the garage door.\n" ;
  218. (Rand + 7) = "You lick the wall, to see what it tastes like.\n" ;
  219. (Rand + 8) = "You pretend that you're an airplane.  Zoom!\n" ;
  220. (Rand + 9) = "You make spider shadows with your hands.\n";
  221.  
  222. Random =            { Random message daemon }
  223. LOCAL which;
  224.     ($incturn)            { Increment the turn counter }
  225.     ($move wall ($loc .ME))    { Move the wall to my current location }
  226.     ($move floor ($loc .ME))    { Move the floor to my current location }
  227.     ($setg which ($rand 20))
  228.     (IF ($eq @which 1) THEN
  229.     (IF ($ne ($loc [blue ball]) .ALL) THEN
  230.         ($say ($global ($plus Rand 0)))
  231.     )
  232.      ELSEIF ($eq @which 2) THEN
  233.     (IF ($ne ($loc [red ball]) .ALL) THEN
  234.         ($say ($global ($plus Rand 1)))
  235.     )
  236.      ELSEIF ($le @which 10) THEN
  237.     ($say ($global ($plus Rand ($minus @which 1))))
  238.     )
  239. ;
  240.  
  241. NOUN    ME(room1);            { The main actor in this play }
  242.  
  243. (Indent) = TRUE;            { Indent object descriptions }
  244.  
  245. START =
  246.     ($say "\n\n\n\n")            { A few newlines for good measure }
  247.     ($say "It all started so innocently!  Kitty asked you for a haircut, ")
  248.     ($say "so you took Daddy's neato electric razor, and gave her a Mohawk. ")
  249.     ($say "Unfortunately, Mommy and Daddy didn't think it was so neat, and ")
  250.     ($say "they stuck you in here for a fifteen minute time out period...\n\n")
  251.     (StdInit ME)            { Initialize standard }
  252.     ($sdem Random)            { Set up the random message daemon }
  253.     ($sfus ME Parent 15)        { Set up mommy and daddy }
  254.     ($define "both" "red,blue")        { Set up "both" to work }
  255.     ($define "balls" "ball")        { with the balls }
  256. ;
  257.  
  258. { Dwimming routines }
  259.  
  260. DWIMI = ($return (Dwimmer %1));
  261. DWIMD = ($return (Dwimmer %1));
  262.